package com.michael.study.listview

import android.app.Activity
import android.os.Bundle
import android.os.MessageQueue
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import com.michael.study.listview.databinding.ActivityLinearMainBinding

class GridMainActivity : AppCompatActivity() {


    private lateinit var mBinding: ActivityLinearMainBinding
    private var mData = ArrayList<String>();
    private lateinit var mAdapter: LinearAdapter;

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        mBinding = ActivityLinearMainBinding.inflate(layoutInflater)
        setContentView(mBinding.root)
        for (i in 1..20) {
            mData.add("" + i)
        }

        mAdapter = LinearAdapter(this, mData)
        var manager = GridLayoutManager(this, 3)

        mBinding.recyclerView.layoutManager = manager
        mBinding.recyclerView.adapter = mAdapter


    }
}